package model

//列表参数
type ListParams struct {
	GetCount bool //是否统计总数（不含Limit和Offset的记录集总数）
	Limit    int
	Offset   int
	Page     int
}

//代理商数据表模型
type Agent struct {
	tableName        struct{} `sql:"agent"`        //表名
	ID               int64    `sql:"id"`           //代理商ID
	Email            string   `sql:"email"`        //电邮地址
	Password         string   `sql:"password"`     //代理商后台登录密码
	Type             bool     `sql:"type,notnull"` //代理商类型(false个人/true团队)
	TypeNotNull      bool     //type字段值是否为空
	TeamName         string   `sql:"team_name"`          //代理商团队名称(仅团队)
	WXAppID          string   `sql:"wx_appid"`           //代理商微信公众号APPID
	WXSecret         string   `sql:"wx_secret"`          //代理商微信公众号SECRET
	WXToken          string   `sql:"wx_token"`           //代理商微信公众号TOKEN
	FullName         string   `sql:"fullname"`           //负责人姓名
	Mobile           string   `sql:"mobile"`             //负责人手机号码
	BankNumber       string   `sql:"bank_number"`        //收款银行账号
	BankName         string   `sql:"bank_name"`          //收款银行名称
	LicenceNumber    string   `sql:"licence_number"`     //营业执照号码（仅团队）
	LicencePhoto     string   `sql:"licence_photo"`      //营业执照照片（仅团队）
	IDCardNumber     string   `sql:"idcard_number"`      //身份证号码（仅个人）
	IDCardFrontPhoto string   `sql:"idcard_front_photo"` //身份证正面照片（仅个人）
	IDCardBackPhoto  string   `sql:"idcard_back_photo"`  //身份证背面照片（仅个人）
	RegTime          int64    `sql:"reg_time"`           //注册时间
	Deleted          bool     `sql:"deleted,notnull"`    //标记为已删除
}

type Admin struct {
	tableName struct{} `sql:"admin"`
	ID        int64    `sql:"id"`
	Name      string   `sql:"name"`
	Email     string   `sql:"email"`
	Mobile    string   `sql:"mobile"`
	Password  string   `sql:"password"`
}

type User struct {
	tableName    struct{} `sql:"user"`
	ID           int64    `sql:"id"`
	WXAppID      string   `sql:"wx_appid"`
	WXOpenID     string   `sql:"wx_openid"`
	RegSource    string   `sql:"reg_source"`
	AgentID      int64    `sql:"agent_id"`
	ParentID     int64    `sql:"parent_id"`
	NickName     string   `sql:"nickname"`
	FullName     string   `sql:"fullname"`
	Email        string   `sql:"email"`
	Mobile       string   `sql:"mobile"`
	BankNumber   string   `sql:"bank_number"`
	Balance      int64    `sql:"balance"`
	RegTime      int64    `sql:"reg_time"`
	IDCardNumber string   `sql:"idcard_number"`
	Header       string   `sql:"header"`
	Deleted      bool     `sql:"deleted,not_null"`
	FollowItem   []int64  `pg:"follow_item,array"`
	SearchTime1  int64    `sql:"reg_time"`
	SearchTime2  int64    `sql:"reg_time"`
	Brokerage    int64    `sql:"brokerage"`
}

type Item struct {
	tableName        struct{} `sql:"item"` //表名
	ID               int64    `sql:"id"`
	Name             string   `sql:"name"`
	Source           string   `sql:"source"`             //数据源（cioibase/sina）
	SourceUrl        string   `sql:"source_url"`         //数据源URL
	Scale            float64  `sql:"scale"`              //原始价格 * scale = 最终价格
	Level1ProfitRate int32    `sql:"level1_profit_rate"` //档位一盈利率
	Level2ProfitRate int32    `sql:"level2_profit_rate"` //档位一的目标价格计算倍率
	Level3ProfitRate int32    `sql:"level3_profit_rate"`
	Level1PriceRate  float32  `sql:"level1_price_rate"`
	Level2PriceRate  float32  `sql:"level2_price_rate"`
	Level3PriceRate  float32  `sql:"level3_price_rate"`
	AllowPay         bool     `sql:"allow_pay,not_null"`
	AllowShow        bool     `sql:"allow_show,not_null"`
	Hot              bool     `sql:"hot"`
	SortID           int      `sql:"sort_id"`
	Deleted          bool     `sql:"deleted,not_null"`
	CloseWeek        []int64  `pg:"close_week,array"`
}

//未完成订单数据表模型
type OrderTradeInComplete struct {
	tableName    struct{} `sql:"order_trade_incomplete"`
	ID           int64    `sql:"id"`
	UserID       int64    `sql:"user_id"`
	ItemID       int64    `sql:"item_id"`
	ItemName     string   `sql:"item_name"`
	Amount       int64    `sql:"amount"`
	Direction    bool     `sql:"direction,not_null"`
	Level        int      `sql:"level"`
	HoldLimit    int64    `sql:"hold_limit"`
	BuyTime      int64    `sql:"buy_time"`
	BuyPrice     float64  `sql:"buy_price"`
	SellTime     int64    `sql:"sell_time"`
	SellPrice    float64  `sql:"sell_price,not_null"`
	IncomeAmount int      `sql:"income_amount,not_null"`
	Rate         int      `sql:"rate"`
}

//已完成订单数据表模型
type OrderTradeCompleted struct {
	tableName    struct{} `sql:"order_trade_completed"`
	ID           int64    `sql:"id"`
	UserID       int64    `sql:"user_id"`
	ItemID       int64    `sql:"item_id"`
	ItemName     string   `sql:"item_name"`
	Amount       int64    `sql:"amount"`
	Direction    bool     `sql:"direction,not_null"`
	Level        int      `sql:"level"`
	HoldLimit    int64    `sql:"hold_limit"`
	BuyTime      int64    `sql:"buy_time"`
	BuyPrice     float64  `sql:"buy_price"`
	SellTime     int64    `sql:"sell_time"`
	SellPrice    float64  `sql:"sell_price,not_null"`
	IncomeAmount int      `sql:"income_amount,not_null"`
	Rate         int      `sql:"rate"`
}

//充值订单数据表模型
type RechargeOrder struct {
	tableName struct{} `sql:"recharge_order"`
	ID        int64    `sql:"id"`                //订单ID
	UserID    int64    `sql:"user_id"`           //所属用户ID
	Amount    int64    `sql:"amount"`            //金额
	StartTime int64    `sql:"start_time"`        //发起时间
	EndTime   int64    `sql:"end_time,not_null"` //完成时间
	Status    bool     `sql:"status,not_null"`   //订单状态，默认为false，未完成
}

//提现订单数据表模型
type WithdrawOrder struct {
	tableName    struct{} `sql:"withdraw_order"`
	ID           int64    `sql:"id"`
	UserID       int64    `sql:"user_id"`           //用户ID
	Amount       int64    `sql:"amount"`            //金额
	StartTime    int64    `sql:"start_time"`        //提现发起时间
	EndTime      int64    `sql:"end_time,not_null"` //提现完成时间
	Status       bool     `sql:"status,not_null"`   //提现状态
	Name         string   `sql:"name"`              //真实姓名
	Mobile       string   `sql:"mobile"`            //手机号
	IDCardNumber string   `sql:"idcard_number"`     //身份证号
	BankName     string   `sql:"bank_name"`         //银行名称
	BankBranch   string   `sql:"bank_branch"`       //银行支行名称
	BankNumber   string   `sql:"bank_number"`       //银行卡号
	QueryStatus  bool     `sql:"query_status,not_null"`
}

//经纪人佣金结算表模型
type Brokerage struct {
	tableName struct{} `sql:"brokerage"`
	ID        int64    `sql:"id"`
	UserID    int64    `sql:"user_id"`         //用户ID
	Amount    int64    `sql:"amount"`          //结算金额
	Status    bool     `sql:"status,not_null"` //状态
	Time      int64    `sql:"time"`            //结算时间
}

//支付渠道表模型
type Channel struct {
	tableName struct{} `sql:"channel"`
	ID        int64    `sql:"id"`
	Name      string   `sql:"name"`            //渠道名称
	Code      string   `sql:"code"`            //渠道代码，方法名
	Status    bool     `sql:"status,not_null"` //渠道是否可用，true-可用/false-不可用
}
